Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove domain parameters #8840

Conversation

gilles-peskine-arm
Copy link
Contributor

@gilles-peskine-arm gilles-peskine-arm commented Feb 15, 2024

Remove domain parameters from the PSA API, since we have an alternative way of choosing a custom public exponent for RSA keys and we don't intend to use them for anything else. Resolve #6495.

Continues #8815, will be rebased once that is merged.

Follow-up: #6496 (started in #7743, but removing domain parameters changing the deal).

PR checklist

  • changelog provided
  • backport no
  • tests no

@gilles-peskine-arm gilles-peskine-arm added enhancement needs-ci Needs to pass CI tests needs-preceding-pr Requires another PR to be merged first component-psa PSA keystore/dispatch layer (storage, drivers, …) priority-high High priority - will be reviewed soon size-xs Estimated task size: extra small (a few hours at most) labels Feb 15, 2024
@gilles-peskine-arm gilles-peskine-arm force-pushed the domain_parameters-remove branch 2 times, most recently from 24b0bab to f5e21e1 Compare February 16, 2024 12:56
Copy link
Contributor

@mpg mpg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me except for a naming issue.

@@ -109,6 +109,15 @@ psa_status_t mbedtls_psa_rsa_export_public_key(
* entry point.
*
* \param[in] attributes The attributes for the RSA key to generate.
* \param[in] method Customization parameters for the key
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think later commits in #8815 renamed "method" to "production parameters" so this probably needs updating as well for consistency.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Remove the ability to select a custom public exponent via domain parameters
in RSA key generation. The only way to select a custom public exponent is
now to pass custom production parameters to psa_generate_key_ext().

A subsequent commit will remove domain parameters altogether from the API,
thus this commit does not bother to update the documentation.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Only leave deprecated, minimal non-linkable functions.

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
@gilles-peskine-arm gilles-peskine-arm changed the base branch from development to gh-readonly-queue/development/pr-8838-0f63028809e775eb068b3575a1fd36f1ed917ff0 February 26, 2024 11:46
@gilles-peskine-arm gilles-peskine-arm changed the base branch from gh-readonly-queue/development/pr-8838-0f63028809e775eb068b3575a1fd36f1ed917ff0 to development February 26, 2024 11:46
@gilles-peskine-arm gilles-peskine-arm added needs-review Every commit must be reviewed by at least two team members, needs-reviewer This PR needs someone to pick it up for review and removed needs-ci Needs to pass CI tests needs-preceding-pr Requires another PR to be merged first labels Feb 26, 2024
@valeriosetti valeriosetti self-requested a review February 26, 2024 11:50
@tom-daubney-arm tom-daubney-arm self-requested a review February 26, 2024 13:11
@tom-daubney-arm tom-daubney-arm removed the needs-reviewer This PR needs someone to pick it up for review label Feb 26, 2024
Copy link
Contributor

@valeriosetti valeriosetti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only left 1 comment, but a part from that this PR looks OK to me.

@@ -7576,11 +7426,8 @@ psa_status_t psa_generate_key_internal(
* that mbedtls_psa_rsa_generate_key() gets e via a new
* parameter instead. */
psa_key_attributes_t override_attributes = *attributes;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need to copy this structure? Can't we just pass attributes to mbedtls_psa_rsa_generate_key()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, duh, yes. And also the comment above is obsolete, that was the whole point of this change.

valeriosetti
valeriosetti previously approved these changes Feb 26, 2024
Copy link
Contributor

@valeriosetti valeriosetti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for addressing my comments. LGTM :)

Copy link
Contributor

@mpg mpg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me except for a possible rebase mistake. Please clarify If this was intentional.

unlock_status = psa_unregister_read_under_mutex(slot);

return (status == PSA_SUCCESS) ? unlock_status : status;
return psa_unregister_read(slot);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code this replaces was calling psa_unregister_read_under_mutex(). Is the change intentional or was it missed during rebase?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebase mistake. Not caught by testing yet (thanks Ryan), would have caused headaches once the Tsan testing is in place. Thanks for catching it!

Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
@mpg mpg added approved Design and code approved - may be waiting for CI or backports and removed needs-review Every commit must be reviewed by at least two team members, labels Feb 27, 2024
@tom-cosgrove-arm tom-cosgrove-arm added this pull request to the merge queue Feb 27, 2024
Merged via the queue into Mbed-TLS:development with commit ca21b24 Feb 27, 2024
4 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Design and code approved - may be waiting for CI or backports component-psa PSA keystore/dispatch layer (storage, drivers, …) enhancement priority-high High priority - will be reviewed soon size-optimisation size-xs Estimated task size: extra small (a few hours at most)
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Remove support for domain parameters
5 participants